VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form RCobranzas 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Reporte de Cobranzas por"
   ClientHeight    =   5790
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8535
   Icon            =   "RCobranzas.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5790
   ScaleWidth      =   8535
   StartUpPosition =   1  'CenterOwner
   Begin SICCS.UclServicio UclSerDel 
      Height          =   315
      Left            =   480
      TabIndex        =   3
      Top             =   600
      Width           =   8055
      _ExtentX        =   14208
      _ExtentY        =   556
   End
   Begin SICCS.UclServicio UclSerAl 
      Height          =   315
      Left            =   480
      TabIndex        =   4
      Top             =   1080
      Width           =   8055
      _ExtentX        =   14208
      _ExtentY        =   556
   End
   Begin VB.ListBox LstCobradores 
      Height          =   1185
      ItemData        =   "RCobranzas.frx":058A
      Left            =   6600
      List            =   "RCobranzas.frx":058C
      Style           =   1  'Checkbox
      TabIndex        =   10
      Top             =   1920
      Width           =   1815
   End
   Begin VB.ListBox LstSucursales 
      Height          =   1185
      ItemData        =   "RCobranzas.frx":058E
      Left            =   4680
      List            =   "RCobranzas.frx":0590
      Style           =   1  'Checkbox
      TabIndex        =   9
      Top             =   1920
      Width           =   1815
   End
   Begin VB.OptionButton OptFechaFactura 
      Caption         =   "Fecha de Factura"
      Height          =   255
      Left            =   3480
      TabIndex        =   15
      Top             =   4800
      Width           =   1575
   End
   Begin VB.OptionButton OptFechaReporte 
      Caption         =   "Fecha de Reporte"
      Height          =   255
      Left            =   3480
      TabIndex        =   14
      Top             =   4440
      Value           =   -1  'True
      Width           =   1695
   End
   Begin VB.TextBox TxtTitulo 
      Height          =   285
      Left            =   1320
      MaxLength       =   50
      TabIndex        =   13
      Top             =   4080
      Width           =   7095
   End
   Begin VB.TextBox TxtNitDel 
      Height          =   285
      Left            =   1320
      MaxLength       =   15
      TabIndex        =   0
      Top             =   120
      Visible         =   0   'False
      Width           =   1695
   End
   Begin VB.TextBox TxtNitAl 
      Height          =   285
      Left            =   3360
      MaxLength       =   15
      TabIndex        =   1
      Top             =   120
      Visible         =   0   'False
      Width           =   1695
   End
   Begin VB.CheckBox ChkResumen 
      Alignment       =   1  'Right Justify
      Caption         =   "Resumen"
      Height          =   255
      Left            =   7080
      TabIndex        =   2
      Top             =   120
      Width           =   1275
   End
   Begin VB.Frame FraTipoPago 
      Caption         =   "Tipo de Pago"
      Height          =   1815
      Left            =   1320
      TabIndex        =   20
      Top             =   1680
      Width           =   3255
      Begin VB.ListBox LstTipoPago 
         Height          =   1185
         ItemData        =   "RCobranzas.frx":0592
         Left            =   1320
         List            =   "RCobranzas.frx":0594
         Style           =   1  'Checkbox
         TabIndex        =   7
         Top             =   240
         Width           =   1815
      End
      Begin VB.CheckBox ChkCanceladas 
         Caption         =   "Canceladas"
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   240
         Value           =   1  'Checked
         Width           =   1170
      End
      Begin VB.CheckBox ChkPorCobrar 
         Caption         =   "Por Cobrar"
         Height          =   255
         Left            =   120
         TabIndex        =   8
         Top             =   1440
         Value           =   1  'Checked
         Width           =   1095
      End
      Begin VB.CheckBox ChkPagoACuenta 
         Caption         =   "Pag. A Cta"
         Height          =   255
         Left            =   120
         TabIndex        =   6
         Top             =   600
         Value           =   1  'Checked
         Visible         =   0   'False
         Width           =   1095
      End
   End
   Begin MSComCtl2.DTPicker CmbFechaAl 
      Height          =   315
      Left            =   3120
      TabIndex        =   12
      Top             =   3600
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   556
      _Version        =   393216
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Format          =   58851329
      CurrentDate     =   39210
   End
   Begin MSComCtl2.DTPicker CmbFechaDel 
      Height          =   315
      Left            =   1320
      TabIndex        =   11
      Top             =   3600
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   556
      _Version        =   393216
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Format          =   58851329
      CurrentDate     =   39210
   End
   Begin MSForms.CommandButton KBAceptar 
      Height          =   375
      Left            =   2460
      TabIndex        =   16
      Top             =   5280
      Width           =   1455
      Caption         =   " Imprimir"
      PicturePosition =   327683
      Size            =   "2566;661"
      Picture         =   "RCobranzas.frx":0596
      Accelerator     =   73
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton KBCancelar 
      Height          =   375
      Left            =   4620
      TabIndex        =   17
      Top             =   5280
      Width           =   1455
      Caption         =   " Cancelar"
      PicturePosition =   327683
      Size            =   "2566;661"
      Picture         =   "RCobranzas.frx":0B30
      Accelerator     =   67
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin VB.Label Label1 
      Caption         =   "Cobradores"
      Height          =   255
      Left            =   6600
      TabIndex        =   22
      Top             =   1680
      Width           =   975
   End
   Begin VB.Label LabTitulo 
      Alignment       =   1  'Right Justify
      Caption         =   "Titulo (opcional):"
      Height          =   255
      Left            =   0
      TabIndex        =   25
      Top             =   4080
      Width           =   1215
   End
   Begin VB.Label LabFechasAl 
      Alignment       =   1  'Right Justify
      Caption         =   "Al:"
      Height          =   255
      Left            =   2760
      TabIndex        =   24
      Top             =   3600
      Width           =   255
   End
   Begin VB.Label LabFechasDel 
      Alignment       =   1  'Right Justify
      Caption         =   "Fechas......del:"
      Height          =   255
      Left            =   120
      TabIndex        =   23
      Top             =   3600
      Width           =   1095
   End
   Begin VB.Label LabSucursal 
      Alignment       =   1  'Right Justify
      Caption         =   "Sucursal"
      Height          =   255
      Left            =   4680
      TabIndex        =   21
      Top             =   1680
      Width           =   615
   End
   Begin VB.Label LabNitDel 
      Alignment       =   1  'Right Justify
      Caption         =   "Ruc/Nit...Del:"
      Height          =   255
      Left            =   240
      TabIndex        =   18
      Top             =   120
      Visible         =   0   'False
      Width           =   975
   End
   Begin VB.Label LabNitAl 
      Caption         =   "Al:"
      Height          =   255
      Left            =   3120
      TabIndex        =   19
      Top             =   120
      Visible         =   0   'False
      Width           =   255
   End
End
Attribute VB_Name = "RCobranzas"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private tipoReporte As String

Private subtitulo As String
Private reporte As String

Private Sub Form_Load()
    Dim i As Integer
    Dim sucs As ClsSucursalFacturacion
    Set sucs = New ClsSucursalFacturacion
    sucs.llenaList LstSucursales, True, False
    Dim cobs As ClsCobrador
    Set cobs = New ClsCobrador
    cobs.llenaList LstCobradores, True, "1", True
    Dim tpas As ClsTipoPago
    Set tpas = New ClsTipoPago
    tpas.llenaList LstTipoPago, True
    If LstSucursales.ListCount > 0 Then
        LstSucursales.ListIndex = 0
        'LstSucursales.Selected(0) = True
        For i = 0 To LstSucursales.ListCount - 1
            LstSucursales.Selected(i) = True
        Next
    End If
    If LstCobradores.ListCount > 0 Then
        LstCobradores.ListIndex = 0
        'LstCobradores.Selected(0) = True
        For i = 0 To LstCobradores.ListCount - 1
            LstCobradores.Selected(i) = True
        Next
    End If
    If LstTipoPago.ListCount > 0 Then
        LstTipoPago.ListIndex = 0
        'LstTipoPago.Selected(0) = True
        For i = 0 To LstTipoPago.ListCount - 1
            LstTipoPago.Selected(i) = True
        Next
    End If
    'la fecha de hoy por default
    CmbFechaDel.value = FechaHoyServidor
    CmbFechaAl.value = FechaHoyServidor
    'servicios
    UclSerDel.cargarServicios False, False, False, False
    UclSerAl.cargarServicios False, False, False, False
End Sub

Public Sub cargar(tipoRepo As String)
    tipoReporte = UCase(tipoRepo)
    Select Case tipoReporte
        Case "SUCURSAL":
            subtitulo = "Por Sucursal"
            reporte = "rpt_cob_sucursal"
            Caption = Caption & " Sucursales"
        Case "CUENTA":
            subtitulo = "Por Cuenta Contable"
            reporte = "rpt_cob_ctacontable"
            Caption = Caption & " Cuentas contables"
        Case "NIT":
            subtitulo = "Por Nit"
            reporte = "rpt_cob_nit"
            Caption = Caption & " NIT"
            TxtNitDel.Visible = True
            TxtNitAl.Visible = True
            LabNitDel.Visible = True
            LabNitAl.Visible = True
        Case "COBRADOR":
            subtitulo = "Por Cobrador"
            reporte = "rpt_cob_cobrador"
            Caption = Caption & " Cobradores"
    End Select
    
End Sub

Private Sub KBAceptar_Click()
    'primero valida los datos de las cuentas y los nits
    Dim imprimir As Boolean
    Dim titulorep As String
    imprimir = True
    
    If imprimir Then
        If Strings.LenB(Strings.Trim(TxtTitulo.Text)) > 0 Then
            titulorep = TxtTitulo.Text
        Else
            titulorep = "REPORTE DIARIO DE COBRANZAS - " & Strings.UCase(GNodo.nombre)
        End If
        
        'busca las cuentas contables de los servicios
        MGeneraRptGral.rptgral Me.TxtNitDel.Text, TxtNitAl.Text, _
                               UclSerDel.servicio.codigo, UclSerAl.servicio.codigo, _
                               Me.ChkCanceladas, Me.ChkPorCobrar, Me.LstTipoPago, _
                               Me.LstSucursales, Me.LstCobradores, _
                               Me.CmbFechaDel.value, Me.CmbFechaAl.value, _
                               titulorep, subtitulo, Me.OptFechaFactura, Me.OptFechaReporte, _
                               Me.ChkResumen, reporte
    Else
        'hubo un error al imprimir
        'muestra mensaje
    End If
End Sub

Private Sub KBCancelar_Click()
    Unload Me
End Sub
